home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / reuse.lha / reuse / m2c / Texts.c < prev    next >
C/C++ Source or Header  |  1992-08-18  |  2KB  |  112 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_IO
  4. #include "IO.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_Lists
  8. #include "Lists.h"
  9. #endif
  10.  
  11. #ifndef DEFINITION_Strings
  12. #include "Strings.h"
  13. #endif
  14.  
  15. #ifndef DEFINITION_StringMem
  16. #include "StringMem.h"
  17. #endif
  18.  
  19. #ifndef DEFINITION_Lists
  20. #include "Lists.h"
  21. #endif
  22.  
  23. #ifndef DEFINITION_Texts
  24. #include "Texts.h"
  25. #endif
  26.  
  27.  
  28.  
  29.  
  30. void Texts_MakeText
  31. # ifdef __STDC__
  32. (Texts_tText *Text)
  33. # else
  34. (Text)
  35. Texts_tText *Text;
  36. # endif
  37. {
  38.   Lists_MakeList(Text);
  39. }
  40.  
  41. void Texts_Append
  42. # ifdef __STDC__
  43. (Texts_tText *Text, Strings_tString *String)
  44. # else
  45. (Text, String)
  46. Texts_tText *Text;
  47. Strings_tString *String;
  48. # endif
  49. {
  50.   Lists_Append(Text, (ADDRESS)StringMem_PutString(String));
  51. }
  52.  
  53. void Texts_Insert
  54. # ifdef __STDC__
  55. (Texts_tText *Text, Strings_tString *String)
  56. # else
  57. (Text, String)
  58. Texts_tText *Text;
  59. Strings_tString *String;
  60. # endif
  61. {
  62.   Lists_Insert(Text, (ADDRESS)StringMem_PutString(String));
  63. }
  64.  
  65. BOOLEAN Texts_IsEmpty
  66. # ifdef __STDC__
  67. (Texts_tText *Text)
  68. # else
  69. (Text)
  70. Texts_tText *Text;
  71. # endif
  72. {
  73.   return Lists_IsEmpty(*Text);
  74. }
  75.  
  76. void Texts_WriteText
  77. # ifdef __STDC__
  78. (IO_tFile f, Texts_tText Text)
  79. # else
  80. (f, Text)
  81. IO_tFile f;
  82. Texts_tText Text;
  83. # endif
  84. {
  85.   Strings_tString String;
  86.  
  87.   while (!Lists_IsEmpty(Text)) {
  88.     StringMem_GetString((StringMem_tStringRef)Lists_Head(Text), &String);
  89.     Strings_WriteL(f, &String);
  90.     Lists_Tail(&Text);
  91.   }
  92. }
  93.  
  94. void BEGIN_Texts()
  95. {
  96.   static BOOLEAN has_been_called = FALSE;
  97.  
  98.   if (!has_been_called) {
  99.     has_been_called = TRUE;
  100.  
  101.     BEGIN_IO();
  102.     BEGIN_Lists();
  103.     BEGIN_Strings();
  104.     BEGIN_IO();
  105.     BEGIN_Lists();
  106.     BEGIN_Strings();
  107.     BEGIN_StringMem();
  108.     BEGIN_Lists();
  109.  
  110.   }
  111. }
  112.